﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Configuration;

namespace Tracy.Engine
{
    /// <summary>
    /// 设置管理器
    /// </summary>
    public class SettingsManager
    {
        /// <summary>
        /// 缓存
        /// </summary>
        private Dictionary<string, string> entries = new Dictionary<string,string>();
        
        /// <summary>
        /// 读取/写入系统设置
        /// </summary>
        public string this[string key]
        {
            get 
            {
                if (!entries.ContainsKey(key))
                {
                    entries[key] = ConfigurationManager.AppSettings[key];
                }
                return entries[key];
            }
            set
            {
                entries[key] = value;
                ConfigurationManager.AppSettings.Set(key, value);
            }
        }



    }
}
